module.exports = {

	data() {
		return {
			mpShare: {
				hideShare:false,
				title: '', // 默认为小程序名称
				path: '', // 默认为当前页面路径
				imageUrl: '' // 默认为当前页面的截图
			}
		}
	},
	onLoad() {
		this.initShare()
	},
	methods: {
		initShare(obj) {
			if (obj) {
				this.mpShare = obj
			}
			//白名单
			const urlList = [
				'pages/life/index',
				'pages/index/index'
			]
			//获取路由信息
			const pages = getCurrentPages()
			//获取当前路由
			let nowPage = pages[pages.length - 1]

			console.log(nowPage, 11111111111)
			uni.showShareMenu()
			//判断路由包含‘takeoutPackageA’标识的同时不包含有白名单的路由就禁用
			if (!urlList.includes(nowPage.route) || this.mpShare.hideShare) {
				uni.hideShareMenu()
			}
		},
	},
	onShareAppMessage() {
		return this.mpShare
	},
	// #ifdef MP-WEIXIN
	onShareTimeline() {
		return this.mpShare
	}
	// #endif
}